<?php
/**
 * Product list toolbar
 *
 * @see Mage_Catalog_Block_Product_List_Toolbar
 */
?>
<?php if($this->getCollection()->getSize()): ?>
<div class="toolbar">
    <div class="pager">
        <?php echo $this->getPagerHtml() ?>

        <div class="limiter">
            <label><?php echo $this->__('Show: ') ?></label>
            <select onchange="setLocation(this.value)">
            <?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
                <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
                    <?php echo $_limit ?>
                </option>
            <?php endforeach; ?>
            </select>
        </div>

        <p class="amount">
            <?php if($this->getLastPageNum()>1): ?>
                <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
            <?php else: ?>
                <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong>
            <?php endif; ?>
        </p>

    </div>

    <?php if( $this->isExpanded() ): ?>
    <div class="sorter">
        <div class="sorter-holder">
        <?php 
            $_helper = $this->helper('catalog/product_compare');
        ?>
        <div class="sort-by">
            <label><?php echo $this->__('Sort By') ?></label>
            <select onchange="setLocation(this.value)">
            <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
                <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                    <?php echo $this->__($_order) ?>
                </option>
            <?php endforeach; ?>
            </select>
            <?php if($this->getCurrentDirection() == 'desc'): ?>
                <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
            <?php else: ?>
                <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
            <?php endif; ?>
        </div>
<?php
    $block = new Trego_Ajaxfilter_Block_Catalog_Layer_Filter_Price();
    echo $block->getHtml();
?>
        <?php if( $this->isEnabledViewSwitcher() ): ?>
        <div class="view-mode">
            <?php $_modes = $this->getModes(); ?>
            <?php if($_modes && count($_modes)>1): ?>
            <?php foreach ($this->getModes() as $_code=>$_label): ?>
                <?php if($this->isModeActive($_code)): ?>
                    <div title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $this->__('View as') ?>&nbsp;<?php echo $_label ?></div>
                <?php else: ?>
                    <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $this->__('View as') ?>&nbsp;<?php echo $_label ?></a>&nbsp;
                <?php endif; ?>
            <?php endforeach; ?>
            <?php endif; ?>
        </div>
        <?php endif; ?>

        <button class="button btn-compare" onclick="setLocation('<?php echo $_helper->getListUrl(); ?>')"><span><span><?php echo $this->__('Compare'); ?></span></span></button>
        </div>
    </div>

    <?php endif; ?>
</div>
<?php endif; ?>
